package indi.zhifa.recipe.bailan.framework.enums.dao.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import indi.zhifa.recipe.bailan.framework.enums.entity.po.SysTypeItemEntity;
import indi.zhifa.recipe.bailan.framework.enums.dao.mapper.TypeItemMapper;
import indi.zhifa.recipe.bailan.framework.enums.dao.service.ITypeItemDbService;
import indi.zhifa.recipe.bailan.framework.mysql.entity.annotations.ZfDbService;
import indi.zhifa.recipe.bailan.framework.mysql.service.impl.ZfDbServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 系统基类 服务实现类
 * </p>
 *
 * @author 织法
 * @since 2022-11-29
 */
@ZfDbService(name = "sys_type_item")
public class TypeItemDbServiceImpl extends ZfDbServiceImpl<TypeItemMapper, SysTypeItemEntity> implements ITypeItemDbService {

    @Override
    public List<SysTypeItemEntity> listByTypeId(Long pTypeId) {
        LambdaQueryWrapper<SysTypeItemEntity> lambdaQueryWrapper = Wrappers.<SysTypeItemEntity>lambdaQuery()
                .eq(SysTypeItemEntity::getTypeId,pTypeId);
        return list(lambdaQueryWrapper);
    }

    @Override
    public void removeByTypeId(Long pTypeId) {
        LambdaUpdateWrapper<SysTypeItemEntity> lambdaUpdateWrapper = Wrappers.<SysTypeItemEntity>lambdaUpdate()
                .eq(SysTypeItemEntity::getTypeId,pTypeId);
        remove(lambdaUpdateWrapper);
    }

}
